# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=z3
pkgver=4.12.4
pkgrel=0
pkgdesc="Theorem prover from Microsoft Research"
url="https://github.com/Z3Prover/z3"
arch="all"
license="MIT"
makedepends="cmake python3 samurai"
subpackages="$pkgname-dev py3-$pkgname:py3:noarch"
source="https://github.com/Z3Prover/z3/archive/z3-$pkgver.tar.gz
	"
builddir="$srcdir/z3-z3-$pkgver"

build() {
	cmake -B build -G Ninja \
		-DZ3_BUILD_PYTHON_BINDINGS=True \
		-DZ3_INSTALL_PYTHON_BINDINGS=True \
		-DPYTHON_EXECUTABLE=/usr/bin/python3 \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=MinSizeRel
	cmake --build build

	# Binary for running the unit tests
	cmake --build build --target test-z3
}

check() {
	./build/test-z3 -a
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

py3() {
	pkgdesc="Python bindings for $pkgname"
	depends="python3"

	amove usr/lib/python3*
}

sha512sums="
fcb778d2e3e0d13fc68afcd8724548279f9edbbb4aac1bbb93e00959c33330ab2fd84f2c2e4b0b78f767819725a90b845fc606a9adc931ae1f0a11f4deae433b  z3-4.12.4.tar.gz
"
